using System;
using System.Collections.Generic;
using System.Data;

public class ViecLamTrong
{
    private Common comm = new Common();

    public static string getChucDanhCha(string ma_chuc_danh)
    {
        Common common = new Common();
        object obj2 = "0";
        string sqlString = " select ma_chuc_danh_cha from DanhMuc_chuc_danh where ma_chuc_danh = '" + ma_chuc_danh + "' ";
        obj2 = common.getDataTable(sqlString).Rows[0][0];
        if (obj2 == DBNull.Value)
        {
            obj2 = "NULL";
        }
        return obj2.ToString();
    }

    public static string getChuyenMonCha(string ma_chuyen_mon)
    {
        Common common = new Common();
        object obj2 = "0";
        string sqlString = " select ma_chuyen_mon_cha from DanhMuc_chuyen_mon where ma_chuyen_mon = '" + ma_chuyen_mon + "' ";
        obj2 = common.getDataTable(sqlString).Rows[0][0];
        if (obj2 == DBNull.Value)
        {
            obj2 = "NULL";
        }
        return obj2.ToString();
    }

    public static List<objYeuCauChuyenMon> getListChuyenMon(string ma_ho_so)
    {
        List<objYeuCauChuyenMon> list = new List<objYeuCauChuyenMon>();
        Common common = new Common();
        DataTable table = new DataTable();
        string sqlString = " select * from  ViecLamTrong_yeu_cau_chuyen_mon where ma_ho_so = '" + ma_ho_so + "' ";
        table = common.getDataTable(sqlString);
        if (table.Rows.Count >= 1)
        {
            for (int i = 0; i < table.Rows.Count; i++)
            {
                objYeuCauChuyenMon item = new objYeuCauChuyenMon();
                item.ma_ho_so = ma_ho_so;
                item.ma_chuyen_mon = table.Rows[i]["ma_chuyen_mon"].ToString();
                item.kinh_nghiem = new int?(Convert.ToInt32(table.Rows[i]["kinh_nghiem"]));
                item.ma_hoc_van = table.Rows[i]["ma_hoc_van"].ToString();
                item.ma_hang_tn = table.Rows[i]["ma_hang_tn"].ToString();
                list.Add(item);
            }
        }
        return list;
    }

    public static List<objYeuCauGiayTo> getListGiayTo(string ma_ho_so)
    {
        List<objYeuCauGiayTo> list = new List<objYeuCauGiayTo>();
        Common common = new Common();
        DataTable table = new DataTable();
        string sqlString = " select *  from yeu_cau_giay_to where ma_ho_so = '" + ma_ho_so + "' ";
        table = common.getDataTable(sqlString);
        if (table.Rows.Count >= 1)
        {
            for (int i = 0; i < table.Rows.Count; i++)
            {
                objYeuCauGiayTo item = new objYeuCauGiayTo();
                item.ma_ho_so = ma_ho_so;
                item.ma_giay_to = table.Rows[i]["ma_giay_to"].ToString();
                item.mo_ta = table.Rows[i]["mo_ta"].ToString();
                list.Add(item);
            }
        }
        return list;
    }

    public static List<objYeuCauKhaNangMem> getListKhaNangMem(string ma_ho_so)
    {
        List<objYeuCauKhaNangMem> list = new List<objYeuCauKhaNangMem>();
        Common common = new Common();
        DataTable table = new DataTable();
        string sqlString = " select *  from yeu_cau_kha_nang_mem where ma_ho_so = '" + ma_ho_so + "' ";
        table = common.getDataTable(sqlString);
        if (table.Rows.Count >= 1)
        {
            for (int i = 0; i < table.Rows.Count; i++)
            {
                objYeuCauKhaNangMem item = new objYeuCauKhaNangMem();
                item.ma_ho_so = ma_ho_so;
                item.ma_kn_mem = table.Rows[i]["ma_kn_mem"].ToString();
                item.mo_ta = table.Rows[i]["mo_ta"].ToString();
                list.Add(item);
            }
        }
        return list;
    }

    public static List<objYeuCauNghiepVu> getListNghiepVu(string ma_ho_so)
    {
        List<objYeuCauNghiepVu> list = new List<objYeuCauNghiepVu>();
        Common common = new Common();
        DataTable table = new DataTable();
        string sqlString = " select * from  vieclamtrong_yeu_cau_nghiep_vu where ma_ho_so = '" + ma_ho_so + "' ";
        table = common.getDataTable(sqlString);
        if (table.Rows.Count >= 1)
        {
            for (int i = 0; i < table.Rows.Count; i++)
            {
                objYeuCauNghiepVu item = new objYeuCauNghiepVu();
                item.ma_ho_so = ma_ho_so;
                item.ma_nghiep_vu = table.Rows[i]["ma_nghiep_vu"].ToString();
                item.ma_hang = table.Rows[i]["ma_hang"].ToString();
                item.mo_ta = table.Rows[i]["mo_ta"].ToString();
                list.Add(item);
            }
        }
        return list;
    }

    public static List<objYeuCauVeNguoi> getListNguoi(string ma_ho_so)
    {
        List<objYeuCauVeNguoi> list = new List<objYeuCauVeNguoi>();
        Common common = new Common();
        DataTable table = new DataTable();
        string sqlString = " select * from  vieclamtrong_yeu_cau_ve_nguoi where ma_ho_so = '" + ma_ho_so + "' ";
        table = common.getDataTable(sqlString);
        if (table.Rows.Count >= 1)
        {
            for (int i = 0; i < table.Rows.Count; i++)
            {
                objYeuCauVeNguoi item = new objYeuCauVeNguoi();
                item.ma_ho_so = ma_ho_so;
                item.nang_den = new int?(Convert.ToInt32(table.Rows[i]["nang_den"]));
                item.nang_tu = new int?(Convert.ToInt32(table.Rows[i]["nang_tu"]));
                item.cao_den = new int?(Convert.ToInt32(table.Rows[i]["cao_den"]));
                item.cao_tu = new int?(Convert.ToInt32(table.Rows[i]["cao_tu"]));
                item.tuoi_den = new int?(Convert.ToInt32(table.Rows[i]["tuoi_den"]));
                item.tuoi_tu = new int?(Convert.ToInt32(table.Rows[i]["tuoi_tu"]));
                item.so_luong = table.Rows[i]["so_luong"].ToString();
                item.mo_ta = table.Rows[i]["mo_ta"].ToString().Trim();
                if (string.IsNullOrEmpty(item.mo_ta))
                {
                    item.gioi_tinh = Convert.ToInt32(table.Rows[i]["gioi_tinh"]).ToString();
                    list.Add(item);
                }
                else
                {
                    bool flag = false;
                    for (int j = 0; j < list.Count; j++)
                    {
                        if (list[j].mo_ta == item.mo_ta)
                        {
                            flag = true;
                            break;
                        }
                    }
                    if (!flag)
                    {
                        item.gioi_tinh = "-1";
                        list.Add(item);
                    }
                }
            }
        }
        return list;
    }

    public string getTenChucDanh(string ma_chuc_danh)
    {
        Common common = new Common();
        object obj2 = "0";
        string sqlString = " select ten_chuc_danh from DanhMuc_chuc_danh where ma_chuc_danh = '" + ma_chuc_danh + "' ";
        obj2 = common.getDataTable(sqlString).Rows[0][0];
        if (obj2 == DBNull.Value)
        {
            obj2 = "NULL";
        }
        return obj2.ToString();
    }

    public string getTenChuyenMon(string ma_chuyen_mon)
    {
        Common common = new Common();
        object obj2 = "NULL";
        string sqlString = " select ten_chuyen_mon from DanhMuc_chuyen_mon where ma_chuyen_mon = '" + ma_chuyen_mon + "' ";
        try
        {
            obj2 = common.getDataTable(sqlString).Rows[0][0];
        }
        catch (Exception)
        {
        }
        if (obj2 == DBNull.Value)
        {
            obj2 = "NULL";
        }
        return obj2.ToString();
    }

    public string getTenHangTN(string ma_hang_tn)
    {
        Common common = new Common();
        object obj2 = "NULL";
        string sqlString = " select ten_hang_tn from DanhMuc_hang_tot_nghiep where ma_hang_tn = '" + ma_hang_tn + "' ";
        try
        {
            obj2 = common.getDataTable(sqlString).Rows[0][0];
        }
        catch (Exception)
        {
        }
        if (obj2 == DBNull.Value)
        {
            obj2 = "NULL";
        }
        return obj2.ToString();
    }

    public string getTenHocVan(string ma_hoc_van)
    {
        Common common = new Common();
        object obj2 = "NULL";
        string sqlString = " select ten_hoc_van from DanhMuc_hoc_van where ma_hoc_van = '" + ma_hoc_van + "' ";
        try
        {
            obj2 = common.getDataTable(sqlString).Rows[0][0];
        }
        catch (Exception)
        {
        }
        if (obj2 == DBNull.Value)
        {
            obj2 = "NULL";
        }
        return obj2.ToString();
    }

    public string getTenKNM(string ma_kn_mem)
    {
        Common common = new Common();
        object obj2 = "NULL";
        string sqlString = " select ten_kn_mem from DanhMuc_kha_nang_mem where ma_kn_mem = '" + ma_kn_mem + "' ";
        try
        {
            obj2 = common.getDataTable(sqlString).Rows[0][0];
        }
        catch (Exception)
        {
        }
        if (obj2 == DBNull.Value)
        {
            obj2 = "NULL";
        }
        return obj2.ToString();
    }

    public string getTenNghiepVu(string ma_nghiep_vu)
    {
        Common common = new Common();
        object obj2 = "NULL";
        string sqlString = " select ten_nghiep_vu from DanhMuc_nghiep_vu where ma_nghiep_vu = '" + ma_nghiep_vu + "' ";
        try
        {
            obj2 = common.getDataTable(sqlString).Rows[0][0];
        }
        catch (Exception)
        {
        }
        if (obj2 == DBNull.Value)
        {
            obj2 = "NULL";
        }
        return obj2.ToString();
    }

    public string getTenThanhPho(string ma_thanh_pho)
    {
        Common common = new Common();
        object obj2 = "NULL";
        string sqlString = " select ten_dia_chi from DanhMuc_dia_chi where ma_dia_chi = '" + ma_thanh_pho + "' ";
        try
        {
            obj2 = common.getDataTable(sqlString).Rows[0][0];
        }
        catch (Exception)
        {
        }
        if (obj2 == DBNull.Value)
        {
            obj2 = "NULL";
        }
        return obj2.ToString();
    }

    public static objViecLamTrong getViecLamTrong(string ma_ho_so)
    {
        objViecLamTrong trong = null;
        Common common = new Common();
        DataTable table = new DataTable();
        string sqlString = " select * from  ViecLamTrong_ho_so_tuyen_dung where ma_ho_so = '" + ma_ho_so + "' ";
        table = common.getDataTable(sqlString);
        if (table.Rows.Count < 1)
        {
            return null;
        }
        trong = new objViecLamTrong();
        trong.ma_ho_so = ma_ho_so;
        trong.ho_khau = table.Rows[0]["ho_khau"].ToString();
        trong.kich_hoat = new bool?(Convert.ToInt32(table.Rows[0]["kich_hoat"]) == 1);
        trong.luong_den = new float?((float) Convert.ToDouble(table.Rows[0]["luong_den"].ToString()));
        trong.luong_tu = new float?((float) Convert.ToDouble(table.Rows[0]["luong_tu"].ToString()));
        trong.ma_chuc_danh = table.Rows[0]["ma_chuc_danh"].ToString();
        trong.ma_doanh_nghiep = table.Rows[0]["ma_doanh_nghiep"].ToString();
        trong.ma_loai_vlt = table.Rows[0]["ma_loai_vlt"].ToString();
        trong.ma_nguon_vlt = table.Rows[0]["ma_nguon_vlt"].ToString();
        trong.ma_thoi_gian = table.Rows[0]["ma_thoi_gian"].ToString();
        trong.mo_ta = table.Rows[0]["mo_ta"].ToString();
        trong.ngay_dang = new DateTime?(Convert.ToDateTime(table.Rows[0]["ngay_dang"].ToString()));
        trong.ngay_du_tuyen = new DateTime?(Convert.ToDateTime(table.Rows[0]["ngay_du_tuyen"].ToString()));
        trong.ngay_het_han = new DateTime?(Convert.ToDateTime(table.Rows[0]["ngay_het_han"].ToString()));
        trong.ngay_nhan = new DateTime?(Convert.ToDateTime(table.Rows[0]["ngay_nhan"].ToString()));
        trong.noi_du_tuyen = table.Rows[0]["noi_du_tuyen"].ToString();
        trong.noi_lam_viec = table.Rows[0]["noi_lam_viec"].ToString();
        trong.noi_nop_ho_so = table.Rows[0]["noi_nop_ho_so"].ToString();
        trong.quyen_loi = table.Rows[0]["quyen_loi"].ToString();
        trong.so_luong_tuyen = Convert.ToInt32(table.Rows[0]["so_luong_tuyen"]);
        trong.tieu_de_ho_so = table.Rows[0]["tieu_de_ho_so"].ToString();
        trong.vi_tri_tuyen_dung = table.Rows[0]["vi_tri_tuyen_dung"].ToString();
        trong.yeu_cau_khac = table.Rows[0]["yeu_cau_cong_viec"].ToString();
        trong.listYeuCauChuyenMon = getListChuyenMon(ma_ho_so);
        trong.yeu_cau_giay_to = table.Rows[0]["yeu_cau_giay_to"].ToString();
        trong.listYeuCauKhaNangMem = getListKhaNangMem(ma_ho_so);
        trong.listYeuCauNghiepVu = getListNghiepVu(ma_ho_so);
        trong.listYeuCauVeNguoi = getListNguoi(ma_ho_so);
        return trong;
    }

    public bool InsertVLT(objViecLamTrong objVLT)
    {
        objVLT.ma_ho_so = comm.GenerateID();
        string sql = " INSERT INTO [ViecLamTrong_ho_so_tuyen_dung]("
        + "[ma_ho_so],"
        + " [ma_doanh_nghiep],"
        + " [vi_tri_tuyen_dung],"
        + " [tieu_de_ho_so], [so_luong_tuyen],  [ngay_nhan], [ngay_het_han], [ngay_du_tuyen], [ho_khau], [noi_lam_viec], [noi_nop_ho_so], [noi_du_tuyen], [luong_tu], [luong_den], [ma_nguon_vlt], [ma_loai_vlt], [ngay_dang], [ma_chuc_danh], [ma_thoi_gian], [yeu_cau_giay_to], [quyen_loi], [yeu_cau_cong_viec], [mo_ta], [ghi_chu], [kich_hoat]) VALUES("
        + "'" + objVLT.ma_ho_so + "'"
        + ", '" + objVLT.ma_doanh_nghiep + "'"
        + ", N'" + objVLT.vi_tri_tuyen_dung + "'"
        + ", N'" + objVLT.tieu_de_ho_so + "'"
        + "," + objVLT.so_luong_tuyen
        + ", '" + objVLT.ngay_nhan.Value.ToString("MM-dd-yyyy") + "'"
        + ", '" + objVLT.ngay_het_han.Value.ToString("MM-dd-yyyy") + "'"
        + ", '" + objVLT.ngay_du_tuyen.Value.ToString("MM-dd-yyyy") + "'"
        + ", N'" + objVLT.ho_khau + "'"
        + ", N'" + objVLT.noi_lam_viec + "'"
        + ", N'" + objVLT.noi_nop_ho_so + "'"
        + ", N'" + objVLT.noi_du_tuyen + "'"
        + ", " + objVLT.luong_tu
        + ", " + objVLT.luong_den
        + ", '" + objVLT.ma_nguon_vlt + "'"
        + ", '" + objVLT.ma_loai_vlt + "'"
        + ", '" + objVLT.ngay_dang.Value.ToString("MM-dd-yyyy") + "'"
        + ", '" + objVLT.ma_chuc_danh + "'"
        + ", '" + objVLT.ma_thoi_gian + "'"
        + ",N'" + objVLT.yeu_cau_giay_to + "'"
        + ", N'" + objVLT.quyen_loi + "'"
        + ",  N'" + objVLT.yeu_cau_khac + "'"
        + ", N'" + objVLT.mo_ta + "'"
        + ",N' Đăng k\x00fd mới '"
        + "," + ((objVLT.kich_hoat == true) ? "1" : "0");
        sql = sql + ")";
        //string sqlString = string.Concat(objArray);
        //string str2 = this.comm.getLastestId(sqlString);
        //objVLT.ma_ho_so = Convert.ToInt32(str2);
        comm.execNoneQuery(sql);
        this.insertYeuCauChuyenMon(objVLT);
        this.insertYeuCauKNM(objVLT);
        this.insertYeuCauNghiepVu(objVLT);
        this.insertYeuCauNguoi(objVLT);
        return false;
    }

    public int insertYeuCauChuyenMon(objViecLamTrong objVLT)
    {
        string sqlString = "";
        foreach (objYeuCauChuyenMon mon in objVLT.listYeuCauChuyenMon)
        {
            sqlString = string.Concat(new object[] { "INSERT INTO [ViecLamTrong_yeu_cau_chuyen_mon]([ma_ho_so], [ma_chuyen_mon], [ma_hoc_van], [ma_hang_tn], [kinh_nghiem], [ngay_tao], [mo_ta]) VALUES('", objVLT.ma_ho_so, "', N'", mon.ma_chuyen_mon, "', '", mon.ma_hoc_van, "',' ", mon.ma_hang_tn, "',", mon.kinh_nghiem, ",getDate(), N'Tạo Mới')" });
            this.comm.execNoneQuery(sqlString);
        }
        return objVLT.listYeuCauChuyenMon.Count;
    }

    public int insertYeuCauKNM(objViecLamTrong objVLT)
    {
        string sqlString = "";
        foreach (objYeuCauKhaNangMem mem in objVLT.listYeuCauKhaNangMem)
        {
            sqlString = string.Concat(new object[] { " INSERT INTO [yeu_cau_kha_nang_mem]([ma_ho_so], [ma_kn_mem], [mo_ta])  VALUES('", objVLT.ma_ho_so, "', N'", mem.ma_kn_mem, "', N'", mem.mo_ta, "') " });
            this.comm.execNoneQuery(sqlString);
        }
        return objVLT.listYeuCauVeNguoi.Count;
    }

    public int insertYeuCauNghiepVu(objViecLamTrong objVLT)
    {
        string sqlString = "";
        foreach (objYeuCauNghiepVu vu in objVLT.listYeuCauNghiepVu)
        {
            sqlString = string.Concat(new object[] { " INSERT INTO [ViecLamTrong_yeu_cau_nghiep_vu]([ma_ho_so], [ma_nghiep_vu], [ma_hang]) VALUES('", objVLT.ma_ho_so, "', N'", vu.ma_nghiep_vu, "', N'", vu.ma_hang, "')" });
            this.comm.execNoneQuery(sqlString);
        }
        return objVLT.listYeuCauNghiepVu.Count;
    }

    public int insertYeuCauNguoi(objViecLamTrong objVLT)
    {
        string sqlString = "";
        foreach (objYeuCauVeNguoi nguoi in objVLT.listYeuCauVeNguoi)
        {
            if (nguoi.gioi_tinh != "-1")
            {
                sqlString = string.Concat(new object[] { 
                    "INSERT INTO [ViecLamTrong_yeu_cau_ve_nguoi]([ma_ho_so], [gioi_tinh], [tuoi_tu], [tuoi_den], [cao_tu], [cao_den], [nang_tu], [nang_den], [so_luong], [mo_ta]) VALUES('", objVLT.ma_ho_so, "', ", nguoi.gioi_tinh, ", ", nguoi.tuoi_tu, ",", nguoi.tuoi_den, ", ", nguoi.cao_tu, ", ", nguoi.cao_den, ",", nguoi.nang_tu, ", ", nguoi.nang_den, 
                    ", N'", nguoi.so_luong, "',N'') "
                 });
                this.comm.execNoneQuery(sqlString);
            }
            else
            {
                sqlString = "select mo_ta from ViecLamTrong_yeu_cau_ve_nguoi where mo_ta is NOT NULL and gioi_tinh=0 and ma_ho_so='" + objVLT.ma_ho_so + "'";
                DataTable table = this.comm.getDataTable(sqlString);
                string str2 = "0001";
                if (table.Rows.Count > 0)
                {
                    str2 = (table.Rows.Count + 1).ToString("D4");
                }
                sqlString = string.Concat(new object[] { 
                    "INSERT INTO [ViecLamTrong_yeu_cau_ve_nguoi]([ma_ho_so], [gioi_tinh], [tuoi_tu], [tuoi_den], [cao_tu], [cao_den], [nang_tu], [nang_den], [so_luong], [mo_ta]) VALUES('", objVLT.ma_ho_so, "',0, ", nguoi.tuoi_tu, ",", nguoi.tuoi_den, ", ", nguoi.cao_tu, ", ", nguoi.cao_den, ",", nguoi.nang_tu, ", ", nguoi.nang_den, ", N'", nguoi.so_luong, 
                    "',N'", str2, "') "
                 });
                this.comm.execNoneQuery(sqlString);
                sqlString = string.Concat(new object[] { 
                    "INSERT INTO [ViecLamTrong_yeu_cau_ve_nguoi]([ma_ho_so], [gioi_tinh], [tuoi_tu], [tuoi_den], [cao_tu], [cao_den], [nang_tu], [nang_den], [so_luong], [mo_ta]) VALUES('", objVLT.ma_ho_so, "',1, ", nguoi.tuoi_tu, ",", nguoi.tuoi_den, ", ", nguoi.cao_tu, ", ", nguoi.cao_den, ",", nguoi.nang_tu, ", ", nguoi.nang_den, ", N'", nguoi.so_luong, 
                    "',N'", str2, "') "
                 });
                this.comm.execNoneQuery(sqlString);
            }
        }
        return objVLT.listYeuCauVeNguoi.Count;
    }

    public static void updateTinhTrang(string ma_ho_so, bool tinh_trang)
    {
        Common common = new Common();
        string sqlString = "";
        sqlString = " Update  ViecLamTrong_ho_so_tuyen_dung set kich_hoat = " + (tinh_trang ? "1" : "0") + "  where ma_ho_so = '" + ma_ho_so + "'";
        common.execNoneQuery(sqlString);
    }

    public void updateVLT(objViecLamTrong objVLT)
    {
        Common common = new Common();
        object[] objArray = new object[] { 
            " UPDATE [ViecLamTrong_ho_so_tuyen_dung] SET   [vi_tri_tuyen_dung]= N'", objVLT.vi_tri_tuyen_dung, "',        [tieu_de_ho_so]=N'", objVLT.tieu_de_ho_so, "',        [so_luong_tuyen]= N'", objVLT.so_luong_tuyen, "',         [ngay_nhan]='", objVLT.ngay_nhan.Value.ToString("MM-dd-yyyy"), "',        [ngay_het_han]= N'", objVLT.ngay_het_han.Value.ToString("MM-dd-yyyy"), "',         [ngay_du_tuyen]= N'", objVLT.ngay_du_tuyen.Value.ToString("MM-dd-yyyy"), "',        [ho_khau]='", objVLT.ho_khau, "',        [noi_lam_viec]= '", objVLT.noi_lam_viec, 
            "',        [noi_nop_ho_so]=N'", objVLT.noi_nop_ho_so, "',        [noi_du_tuyen]=N'", objVLT.noi_du_tuyen, "',        [luong_tu]=", objVLT.luong_tu.Value, ",        [luong_den]=", objVLT.luong_den.Value, ",        [ma_nguon_vlt]='", objVLT.ma_nguon_vlt, "',        [ma_loai_vlt]= '", objVLT.ma_loai_vlt, "',         [ma_chuc_danh]='", objVLT.ma_chuc_danh, "',        [ma_thoi_gian]=N'", objVLT.ma_thoi_gian, 
            "',        [yeu_cau_giay_to]=N'", objVLT.yeu_cau_giay_to, "',        [quyen_loi]=N'", objVLT.quyen_loi, "',        [mo_ta]=N'", objVLT.mo_ta, "' ,        [ghi_chu]=N'", objVLT.yeu_cau_khac, "',        [kich_hoat]=", (objVLT.kich_hoat == true) ? "1" : "0", " WHERE [ma_ho_so] = '", objVLT.ma_ho_so + "'"
         };
        string sqlString = string.Concat(objArray);
        if (common.execNoneQuery(sqlString) > 0)
        {
            sqlString = "Delete from ViecLamTrong_yeu_cau_chuyen_mon where ma_ho_so = '" + objVLT.ma_ho_so + "'";
            common.execNoneQuery(sqlString);
            this.insertYeuCauChuyenMon(objVLT);
            sqlString = "Delete from yeu_cau_kha_nang_mem where ma_ho_so = '" + objVLT.ma_ho_so + "'";
            common.execNoneQuery(sqlString);
            this.insertYeuCauKNM(objVLT);
            sqlString = "Delete from ViecLamTrong_yeu_cau_nghiep_vu where ma_ho_so = '" + objVLT.ma_ho_so + "'";
            common.execNoneQuery(sqlString);
            this.insertYeuCauNghiepVu(objVLT);
            sqlString = "Delete from ViecLamTrong_yeu_cau_ve_nguoi where ma_ho_so = '" + objVLT.ma_ho_so + "'";
            common.execNoneQuery(sqlString);
            this.insertYeuCauNguoi(objVLT);
        }
    }

    public static void xoaVLT(string ma_ho_so)
    {
        Common common = new Common();
        string sqlString = "";
        sqlString = "delete from ViecLamTrong_yeu_cau_chuyen_mon   where ma_ho_so = '" + ma_ho_so + "'";
        common.execNoneQuery(sqlString);
        sqlString = "delete from ViecLamTrong_yeu_cau_nghiep_vu   where ma_ho_so = '" + ma_ho_so + "'";
        common.execNoneQuery(sqlString);
        sqlString = "delete from ViecLamTrong_yeu_cau_doi_tuong   where ma_ho_so = '" + ma_ho_so + "'";
        common.execNoneQuery(sqlString);
        sqlString = "delete from ViecLamTrong_yeu_cau_nghiep_vu   where ma_ho_so = '" + ma_ho_so + "'";
        common.execNoneQuery(sqlString);
        sqlString = "delete from yeu_cau_kha_nang_mem   where ma_ho_so = '" + ma_ho_so + "'";
        common.execNoneQuery(sqlString);
        sqlString = "delete from ViecLamTrong_ho_so_tuyen_dung   where ma_ho_so = '" + ma_ho_so + "'";
        common.execNoneQuery(sqlString);
    }
}

